﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml.Linq;
using ThirdServices.AlertModel;

namespace ThirdServices.WindSettings
{
    public static class WindSpeedTypes
    {
        private static XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("../Settings/Settings.xml"));

        public static List<WindTypeElement> windTypes
        {
            get
            {
                List<WindTypeElement> wTypes = new List<WindTypeElement>();
                foreach (XElement xEl in doc.Descendants("windSettings"))
                {
                    wTypes.Add(new WindTypeElement
                                   {
                                       Name = xEl.Attribute("name").ToString(),
                                       Min = Convert.ToInt32(xEl.Attribute("min").ToString()),
                                       Max = Convert.ToInt32(xEl.Attribute("max").ToString())
                                   });
                }

                return wTypes;
            }
        }
    }
}
